<template>
    <el-breadcrumb separator=">">
        <el-breadcrumb-item v-for="(item,index) in breadList">
            <router-link to="/home" v-if="index==0">首页</router-link>
            {{item.meta.title}}
        </el-breadcrumb-item>
    </el-breadcrumb>
</template>

<script setup>
    import {
        computed
    } from 'vue'

    import {
        useRoute
    } from 'vue-router'

    const route = useRoute()

    //breadList是计算属性
    let breadList = computed(() => {
        //当前点击的路由的所有路径,包含当前点击的路由的所有父级路由
        return route.matched
    })
</script>